package com.evil.application.pojo.dto.order.log;

import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.apache.commons.lang3.StringUtils;

/**
 * 订单节点处理人 (快照)
 *
 * @author liyang
 * @date 2022-08-08 00:00
 */
@Data
@NoArgsConstructor
@AllArgsConstructor
public class OrderNodeAssigneeDTO {

    /**
     * 处理人id
     */
    private Long handlerId;

    /**
     * 处理人名称
     */
    private String handlerName;

    /**
     * 处理组
     */
    private String handlerGroup;

    /**
     * 判断处理人是否同组
     *
     * @param assignee assignee
     * @return boolean
     */
    public boolean isSameGroup(OrderNodeAssigneeDTO assignee) {
        if (StringUtils.isBlank(this.handlerGroup)) {
            if (StringUtils.isBlank(assignee.getHandlerGroup())) {
                return true;
            } else {
                return false;
            }
        } else {
            return this.handlerGroup.equals(assignee.getHandlerGroup());
        }
    }
}
